Optimal. Leaf size=215 \[ -\frac {\left (3 a^2 b B-b^3 B-a^3 C+3 a b^2 C\right ) x}{\left (a^2+b^2\right )^3}+\frac {B \log (\sin (c+d x))}{a^3 d}-\frac {b \left (6 a^4 b B+3 a^2 b^3 B+b^5 B-3 a^5 C+a^3 b^2 C\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{a^3 \left (a^2+b^2\right )^3 d}+\frac {b (b B-a C)}{2 a \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}+\frac {b \left (3 a^2 b B+b^3 B-2 a^3 C\right )}{a^2 \left (a^2+b^2\right )^2 d (a+b \tan (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.47, antiderivative size = 215, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 40, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.150, Rules used = {3713, 3690,
3730, 3732, 3611, 3556} \begin {gather*} \frac {B \log (\sin (c+d x))}{a^3 d}+\frac {b (b B-a C)}{2 a d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}+\frac {b \left (-2 a^3 C+3 a^2 b B+b^3 B\right )}{a^2 d \left (a^2+b^2\right )^2 (a+b \tan (c+d x))}-\frac {x \left (a^3 (-C)+3 a^2 b B+3 a b^2 C-b^3 B\right )}{\left (a^2+b^2\right )^3}-\frac {b \left (-3 a^5 C+6 a^4 b B+a^3 b^2 C+3 a^2 b^3 B+b^5 B\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{a^3 d \left (a^2+b^2\right )^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3611
Rule 3690
Rule 3713
Rule 3730
Rule 3732
Rubi steps
\begin {align*} \int \frac {\cot ^2(c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx &=\int \frac {\cot (c+d x) (B+C \tan (c+d x))}{(a+b \tan (c+d x))^3} \, dx\\ &=\frac {b (b B-a C)}{2 a \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}+\frac {\int \frac {\cot (c+d x) \left (2 \left (a^2+b^2\right ) B-2 a (b B-a C) \tan (c+d x)+2 b (b B-a C) \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^2} \, dx}{2 a \left (a^2+b^2\right )}\\ &=\frac {b (b B-a C)}{2 a \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}+\frac {b \left (3 a^2 b B+b^3 B-2 a^3 C\right )}{a^2 \left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}+\frac {\int \frac {\cot (c+d x) \left (2 \left (a^2+b^2\right )^2 B-2 a^2 \left (2 a b B-a^2 C+b^2 C\right ) \tan (c+d x)+2 b \left (3 a^2 b B+b^3 B-2 a^3 C\right ) \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx}{2 a^2 \left (a^2+b^2\right )^2}\\ &=-\frac {\left (3 a^2 b B-b^3 B-a^3 C+3 a b^2 C\right ) x}{\left (a^2+b^2\right )^3}+\frac {b (b B-a C)}{2 a \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}+\frac {b \left (3 a^2 b B+b^3 B-2 a^3 C\right )}{a^2 \left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}+\frac {B \int \cot (c+d x) \, dx}{a^3}-\frac {\left (b \left (6 a^4 b B+3 a^2 b^3 B+b^5 B-3 a^5 C+a^3 b^2 C\right )\right ) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{a^3 \left (a^2+b^2\right )^3}\\ &=-\frac {\left (3 a^2 b B-b^3 B-a^3 C+3 a b^2 C\right ) x}{\left (a^2+b^2\right )^3}+\frac {B \log (\sin (c+d x))}{a^3 d}-\frac {b \left (6 a^4 b B+3 a^2 b^3 B+b^5 B-3 a^5 C+a^3 b^2 C\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{a^3 \left (a^2+b^2\right )^3 d}+\frac {b (b B-a C)}{2 a \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}+\frac {b \left (3 a^2 b B+b^3 B-2 a^3 C\right )}{a^2 \left (a^2+b^2\right )^2 d (a+b \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 2.08, size = 223, normalized size = 1.04 \begin {gather*} \frac {-\frac {(B+i C) \log (i-\tan (c+d x))}{(a+i b)^3}+\frac {2 B \log (\tan (c+d x))}{a^3}-\frac {(B-i C) \log (i+\tan (c+d x))}{(a-i b)^3}-\frac {2 b \left (6 a^4 b B+3 a^2 b^3 B+b^5 B-3 a^5 C+a^3 b^2 C\right ) \log (a+b \tan (c+d x))}{a^3 \left (a^2+b^2\right )^3}+\frac {b (b B-a C)}{a \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}+\frac {2 b \left (3 a^2 b B+b^3 B-2 a^3 C\right )}{a^2 \left (a^2+b^2\right )^2 (a+b \tan (c+d x))}}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.65, size = 243, normalized size = 1.13 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 372, normalized size = 1.73 \begin {gather*} \frac {\frac {2 \, {\left (C a^{3} - 3 \, B a^{2} b - 3 \, C a b^{2} + B b^{3}\right )} {\left (d x + c\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left (3 \, C a^{5} b - 6 \, B a^{4} b^{2} - C a^{3} b^{3} - 3 \, B a^{2} b^{4} - B b^{6}\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{9} + 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} + a^{3} b^{6}} - \frac {{\left (B a^{3} + 3 \, C a^{2} b - 3 \, B a b^{2} - C b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {5 \, C a^{4} b - 7 \, B a^{3} b^{2} + C a^{2} b^{3} - 3 \, B a b^{4} + 2 \, {\left (2 \, C a^{3} b^{2} - 3 \, B a^{2} b^{3} - B b^{5}\right )} \tan \left (d x + c\right )}{a^{8} + 2 \, a^{6} b^{2} + a^{4} b^{4} + {\left (a^{6} b^{2} + 2 \, a^{4} b^{4} + a^{2} b^{6}\right )} \tan \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b + 2 \, a^{5} b^{3} + a^{3} b^{5}\right )} \tan \left (d x + c\right )} + \frac {2 \, B \log \left (\tan \left (d x + c\right )\right )}{a^{3}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 683 vs.
\(2 (213) = 426\).
time = 2.35, size = 683, normalized size = 3.18 \begin {gather*} -\frac {7 \, C a^{5} b^{3} - 9 \, B a^{4} b^{4} + C a^{3} b^{5} - 3 \, B a^{2} b^{6} - 2 \, {\left (C a^{8} - 3 \, B a^{7} b - 3 \, C a^{6} b^{2} + B a^{5} b^{3}\right )} d x - {\left (5 \, C a^{5} b^{3} - 7 \, B a^{4} b^{4} - C a^{3} b^{5} - B a^{2} b^{6} + 2 \, {\left (C a^{6} b^{2} - 3 \, B a^{5} b^{3} - 3 \, C a^{4} b^{4} + B a^{3} b^{5}\right )} d x\right )} \tan \left (d x + c\right )^{2} - {\left (B a^{8} + 3 \, B a^{6} b^{2} + 3 \, B a^{4} b^{4} + B a^{2} b^{6} + {\left (B a^{6} b^{2} + 3 \, B a^{4} b^{4} + 3 \, B a^{2} b^{6} + B b^{8}\right )} \tan \left (d x + c\right )^{2} + 2 \, {\left (B a^{7} b + 3 \, B a^{5} b^{3} + 3 \, B a^{3} b^{5} + B a b^{7}\right )} \tan \left (d x + c\right )\right )} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (3 \, C a^{7} b - 6 \, B a^{6} b^{2} - C a^{5} b^{3} - 3 \, B a^{4} b^{4} - B a^{2} b^{6} + {\left (3 \, C a^{5} b^{3} - 6 \, B a^{4} b^{4} - C a^{3} b^{5} - 3 \, B a^{2} b^{6} - B b^{8}\right )} \tan \left (d x + c\right )^{2} + 2 \, {\left (3 \, C a^{6} b^{2} - 6 \, B a^{5} b^{3} - C a^{4} b^{4} - 3 \, B a^{3} b^{5} - B a b^{7}\right )} \tan \left (d x + c\right )\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (3 \, C a^{6} b^{2} - 4 \, B a^{5} b^{3} - 3 \, C a^{4} b^{4} + 3 \, B a^{3} b^{5} + B a b^{7} + 2 \, {\left (C a^{7} b - 3 \, B a^{6} b^{2} - 3 \, C a^{5} b^{3} + B a^{4} b^{4}\right )} d x\right )} \tan \left (d x + c\right )}{2 \, {\left ({\left (a^{9} b^{2} + 3 \, a^{7} b^{4} + 3 \, a^{5} b^{6} + a^{3} b^{8}\right )} d \tan \left (d x + c\right )^{2} + 2 \, {\left (a^{10} b + 3 \, a^{8} b^{3} + 3 \, a^{6} b^{5} + a^{4} b^{7}\right )} d \tan \left (d x + c\right ) + {\left (a^{11} + 3 \, a^{9} b^{2} + 3 \, a^{7} b^{4} + a^{5} b^{6}\right )} d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: AttributeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 479 vs.
\(2 (213) = 426\).
time = 1.28, size = 479, normalized size = 2.23 \begin {gather*} \frac {\frac {2 \, {\left (C a^{3} - 3 \, B a^{2} b - 3 \, C a b^{2} + B b^{3}\right )} {\left (d x + c\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (B a^{3} + 3 \, C a^{2} b - 3 \, B a b^{2} - C b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left (3 \, C a^{5} b^{2} - 6 \, B a^{4} b^{3} - C a^{3} b^{4} - 3 \, B a^{2} b^{5} - B b^{7}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{9} b + 3 \, a^{7} b^{3} + 3 \, a^{5} b^{5} + a^{3} b^{7}} + \frac {2 \, B \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a^{3}} - \frac {9 \, C a^{5} b^{3} \tan \left (d x + c\right )^{2} - 18 \, B a^{4} b^{4} \tan \left (d x + c\right )^{2} - 3 \, C a^{3} b^{5} \tan \left (d x + c\right )^{2} - 9 \, B a^{2} b^{6} \tan \left (d x + c\right )^{2} - 3 \, B b^{8} \tan \left (d x + c\right )^{2} + 22 \, C a^{6} b^{2} \tan \left (d x + c\right ) - 42 \, B a^{5} b^{3} \tan \left (d x + c\right ) - 2 \, C a^{4} b^{4} \tan \left (d x + c\right ) - 26 \, B a^{3} b^{5} \tan \left (d x + c\right ) - 8 \, B a b^{7} \tan \left (d x + c\right ) + 14 \, C a^{7} b - 25 \, B a^{6} b^{2} + 3 \, C a^{5} b^{3} - 19 \, B a^{4} b^{4} + C a^{3} b^{5} - 6 \, B a^{2} b^{6}}{{\left (a^{9} + 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} + a^{3} b^{6}\right )} {\left (b \tan \left (d x + c\right ) + a\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 10.98, size = 315, normalized size = 1.47 \begin {gather*} \frac {\frac {-5\,C\,a^3\,b+7\,B\,a^2\,b^2-C\,a\,b^3+3\,B\,b^4}{2\,a\,\left (a^4+2\,a^2\,b^2+b^4\right )}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-2\,C\,a^3\,b^2+3\,B\,a^2\,b^3+B\,b^5\right )}{a^2\,\left (a^4+2\,a^2\,b^2+b^4\right )}}{d\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (c+d\,x\right )+b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2\right )}+\frac {B\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{a^3\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,d\,\left (-a^3\,1{}\mathrm {i}+3\,a^2\,b+a\,b^2\,3{}\mathrm {i}-b^3\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B-C\,1{}\mathrm {i}\right )}{2\,d\,\left (-a^3+a^2\,b\,3{}\mathrm {i}+3\,a\,b^2-b^3\,1{}\mathrm {i}\right )}-\frac {b\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (-3\,C\,a^5+6\,B\,a^4\,b+C\,a^3\,b^2+3\,B\,a^2\,b^3+B\,b^5\right )}{a^3\,d\,{\left (a^2+b^2\right )}^3} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________